//
//  IDCViewController.m
//  soundplayer
//
//  Created by iD Student on 7/24/13.
//  Copyright (c) 2013 student. All rights reserved.
//

#import "IDCViewController.h"

@interface IDCViewController ()

@end

@implementation IDCViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
	NSURL *url = [[NSBundle mainBundle] URLForResource:@"explosion" withExtension:@"mp3"];
    NSError *error;
    explosionSound = [[AVAudioPlayer alloc] initWithContentsOfURL: url error: &error];
    if(error != nil)
    {
        NSLog(@"Explosion sound could not be loaded!");
    }
    
    NSURL *newURL = [[NSBundle mainBundle] URLForResource:@"laser" withExtension:@"wav"];
    error= nil;
    laserSound =  [[AVAudioPlayer alloc] initWithContentsOfURL: newURL error: &error];
    if(error !=nil)
    {
        NSLog(@"Laser sound could not be loaded! : %@", error);
    }
       
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)button1:(id)sender {
    [explosionSound play];
    }

- (IBAction)button2:(id)sender {
    [laserSound play];
}
@end
